;; Comprehensive test for R4RS Character procedures (section 6.6)
;; This file tests all the essential character procedures implemented

;; Basic character literals
#\a                    ; Regular character
#\space                ; Named character: space
#\tab                  ; Named character: tab  
#\newline              ; Named character: newline
#\return               ; Named character: return
#\A                    ; Uppercase character
#\7                    ; Digit character
#\!                    ; Special character

;; Character predicate
(char? #\a)            ; => #t
(char? 42)             ; => #f  
(char? "a")            ; => #f

;; Character comparison procedures
(char=? #\a #\a)       ; => #t
(char=? #\a #\b)       ; => #f
(char<? #\a #\b)       ; => #t
(char<? #\b #\a)       ; => #f
(char>? #\b #\a)       ; => #t
(char>? #\a #\b)       ; => #f
(char<=? #\a #\a)      ; => #t
(char<=? #\a #\b)      ; => #t
(char<=? #\b #\a)      ; => #f
(char>=? #\a #\a)      ; => #t
(char>=? #\b #\a)      ; => #t
(char>=? #\a #\b)      ; => #f

;; Case-insensitive character comparison procedures
(char-ci=? #\A #\a)    ; => #t
(char-ci=? #\A #\B)    ; => #f
(char-ci<? #\A #\b)    ; => #t
(char-ci<? #\b #\A)    ; => #f
(char-ci>? #\B #\a)    ; => #t
(char-ci>? #\A #\b)    ; => #f
(char-ci<=? #\A #\a)   ; => #t
(char-ci<=? #\A #\b)   ; => #t
(char-ci<=? #\b #\A)   ; => #f
(char-ci>=? #\A #\a)   ; => #t
(char-ci>=? #\B #\a)   ; => #t
(char-ci>=? #\A #\b)   ; => #f

;; Character classification procedures
(char-alphabetic? #\a) ; => #t
(char-alphabetic? #\A) ; => #t
(char-alphabetic? #\7) ; => #f
(char-alphabetic? #\!) ; => #f

(char-numeric? #\7)    ; => #t
(char-numeric? #\a)    ; => #f
(char-numeric? #\!)    ; => #f

(char-whitespace? #\space)   ; => #t
(char-whitespace? #\tab)     ; => #t
(char-whitespace? #\newline) ; => #t
(char-whitespace? #\a)       ; => #f

(char-upper-case? #\A) ; => #t
(char-upper-case? #\a) ; => #f
(char-upper-case? #\7) ; => #f

(char-lower-case? #\a) ; => #t
(char-lower-case? #\A) ; => #f
(char-lower-case? #\7) ; => #f

;; Character conversion procedures
(char->integer #\A)    ; => 65
(char->integer #\a)    ; => 97
(char->integer #\0)    ; => 48
(char->integer #\space); => 32

(integer->char 65)     ; => #\A
(integer->char 97)     ; => #\a
(integer->char 48)     ; => #\0
(integer->char 32)     ; => #\space

(char-upcase #\a)      ; => #\A
(char-upcase #\A)      ; => #\A
(char-upcase #\7)      ; => #\7

(char-downcase #\A)    ; => #\a
(char-downcase #\a)    ; => #\a
(char-downcase #\7)    ; => #\7